project('tutorial', 'c')
module_inc = include_directories('../../src/')
module_srcdir = '../../src/'
module_srcs = files([
  #  module_srcdir + 'account.c',
  #module_srcdir + 'sql.c',
  #module_srcdir + 'email.c',
  ])
sub_srcdir = './'
sub_srcs = files([
  sub_srcdir + 'tsapp.c',
  sub_srcdir + 'tsappwin.c',
  ])
glib_compile_schemas = find_program('glib-compile-schemas')
g_schemas_src = files([sub_srcdir + 'org.gtk.83net.gschema.xml'])
schemas = custom_target('gschemas.compiled',
  input:[g_schemas_src],
  output:['gschemas.compiled'],
  command:[glib_compile_schemas,
    '../'
    ],
  )
glib_compile_resources = find_program('glib-compile-resources')
g_resource_xml = files([sub_srcdir + '83net.gresource.xml'])
ui_src = files('main.ui')
resources_src = custom_target('resources.c',
  #input:[ui_src, g_resource_xml],
  input:[g_resource_xml, ui_src],
  output:['resources.c'],
  command:[glib_compile_resources, '@INPUT0@',
    '--target', '@OUTPUT@',
    '--sourcedir', '../',
    '--generate-source'],
  )
cairo_dep = dependency('cairo')
glib_dep = dependency('glib-2.0')
gtk_dep = dependency('gtk+-3.0')
mosquitto_dep = dependency('libmosquitto')
sqlite3_dep = dependency('sqlite3')
json_glib_dep = dependency('json-glib-1.0')
executable('83net', 'main.c', sub_srcs, resources_src, schemas,
  #build_rpath : '/home/imch/ts/lib',
  #install_rpath : '/home/imch/ts/lib',
  include_directories: [module_inc],
  dependencies : [glib_dep, json_glib_dep, gtk_dep, sqlite3_dep])
